home *** CD-ROM | disk | FTP | other *** search
- Path: news.cern.ch!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: May fprintf () be recursive?
- Date: 18 Apr 96 17:23:31 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.829848211@news.cern.ch>
- References: <4l5f9s$ad3@news.cs.tu-berlin.de>
- NNTP-Posting-Host: ues5.cern.ch
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Content-Transfer-Encoding: 7bit
- X-Newsreader: NN version 6.5.0 #18 (NOV)
-
- In <4l5f9s$ad3@news.cs.tu-berlin.de> ulrich@cs.tu-berlin.de (Ulrich Wittenberg) writes:
-
- >My program developed a strange error in the dynamic memory management
- >when it had a line of the following type in it:
- >
- >fprintf (stderr, "fprintf returns %#X\n", fprintf (stderr, "TEST\n"));
- >
- >So, my question is: Is it allowed for fprintf to be called
- >recursively????
-
- fprintf is _not_ called recursively in this example. The inner fprintf
- call will return before the outer fprintf will be called. Your usage
- is perfectly OK. Only the fprintf function could call itself recursively,
- you can't do that (no matter how hard you try :-)
-
- >BTW: when I changed that line to an iterative way, the program worked
- >fine
- >
- >Suggestions?
-
- 1. There is a bug in your compiler (not very likely).
-
- 2. There is a bug somewhere else in your code and this construct simply
- exposes it. Consider yourself lucky and try to find the real bug.
-
- 3. If you insist that your code is bug free, try to write a minimal
- (but complete) example that illustrates your problem and post it here.
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-